package server;

import util.MyParser;

public final class CommandParser {
	public CommandParser() {

	}

	public static Commands getServerCommands(String s) {
		if (s != null) {
			if (s.equals("newgame")) {
				return Commands.NEWGAME;
			} else if (s.equals("joingame")) {
				return Commands.JOINGAME;
			} else if (s.equals("endofgame")) {
				return Commands.ENDOFGAME;
			} else if (s.equals("getgames")) {
				return Commands.GETGAMES;
			} else if(s.equals("exitgame")) {
				return Commands.EXITGAME;
			} else if(s.equals("name")){
				return Commands.NAME;
			}
			else {
				return Commands.INVALID;
			}
		}
		return Commands.INVALID;

	}

	public static Commands getGameCommands(String temp) {
		if (MyParser.isChat(temp)) {
			return Commands.CHATMESSAGE;
		} else if (MyParser.isGame(temp)) {
			return Commands.GAMEMESSAGE;
		} else if (MyParser.isServerMessage(temp)) {
			return Commands.SERVERMESSAGE;
		} else if (MyParser.isPaint(temp)) {
			return Commands.PAINTMESSAGE;
		} else {
			return Commands.INVALID;
		}
	}

}
